#include <stdio.h>
#include <fcntl.h>
static unsigned char send_buf[10]="1234567";
static unsigned char recv_buf[10];
enum GPIO_CTRL_CMD
{
  GPIO_READY_CTRL = 0,
  GPIO_AFTERRUN_CTRL,
  GPIO_RUN_CTRL,
  GPIO_ALARM_CTRL
};
static void pabort(const char *s)
{
  perror(s);
  abort();
}
void gpio_handler(int num)
{
  printf("the gpio is %d\n",num);
}
int main(){
  int fd;
  int num = 5;
  int i=0;
  char string [256];
  fd = open("/dev/gpio_ww", GPIO_READY_CTRL);
  if (fd < 0)
    pabort("can't open GPIO device");
  ioctl(fd,0,200);
  signal(SIGIO, gpio_handler);
  fcntl(fd, F_SETOWN, getpid());
  oflags = fcntl(fd, F_GETFL);
  fcntl(fd, F_SETFL, oflags | FASYNC);

  gets (string);
  close(fd);
 return 0;
}

